<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    var str = 'qweq-42we234hadasa-s832124-5ooasd'
    var reg = /\d/g
    console.log(reg.exec(str)) // index
    console.log(reg.test(str)) //true false

    //字符串方法

    console.log(str.search(reg)) //下标
    console.log(str.match(reg)) //返回匹配到的数组
    console.log(str.replace(reg, '*')) //匹配替换
    console.log(str.split(reg)) //字符串分割
    var str1 = `hell_world`
    var reg1 = /^h(\w+)d$/g
    console.log(str1.match(reg1)) //
  </script>
</html>
